//
//  Contact_DetailBaseInfoCell3.m
//  HuaRun2
//
//  Created by admin on 2017/9/9.
//  Copyright © 2017年 Sunny. All rights reserved.
//

#import "Contact_DetailBaseInfoCell3.h"
#import "Contact_DetailModel.h"

@interface Contact_DetailBaseInfoCell3 ()

//companyEng
@property (nonatomic, strong) UILabel * companyEngValueLab;
//companyChi
@property (nonatomic, strong) UILabel * companyChiValueLab;

@property (nonatomic, strong) UILabel * contactEng1ValueLab;
@property (nonatomic, strong) UILabel * contactChi1ValueLab;
@property (nonatomic, strong) UILabel * contactEng2ValueLab;
@property (nonatomic, strong) UILabel * contactChi2ValueLab;

@property (nonatomic, strong) UILabel * locationValueLab;

    //tag
@property (nonatomic, strong) UILabel * tagValueLab;
//备注
@property (nonatomic, strong) UILabel * noteValueLab;

@property (nonatomic, strong) UILabel * companykeyLabel;
@property (nonatomic, strong) UILabel * buMenkeyLabel;
@property (nonatomic, strong) UILabel * contactkeyLabel;
@property (nonatomic, strong) UILabel * locationkeyLabel;
@property (nonatomic, strong) UILabel * phonekeyLabel;
@property (nonatomic, strong) UILabel * emailkeyLabel;
@property (nonatomic, strong) UILabel * tagkeyLabel;
@property (nonatomic, strong) UILabel * notekeyLabel;
@end

@implementation Contact_DetailBaseInfoCell3

#pragma mark - life cycle

- (void)setDetailModel:(Contact_DetailModel *)detailModel {
    _detailModel = detailModel;
    
    _locationValueLab.text = [NSString showSpaceStringWithStr:detailModel.division];
    _phone1ValueLab.text =  [NSString showSpaceStringWithStr:detailModel.hkMobile];
    _phone2ValueLab.text = [NSString showSpaceStringWithStr:detailModel.chinaMobile];

    _email1ValueLab.text = [NSString showSpaceStringWithStr:detailModel.email];
    _email2ValueLab.text = [NSString showSpaceStringWithStr:detailModel.email2];

    _contactEng1ValueLab.text = [NSString showSpaceStringWithStr:detailModel.department];
    _contactChi1ValueLab.text = [NSString showSpaceStringWithStr:detailModel.departmentChinese];
    
    _contactEng2ValueLab.text = [NSString showSpaceStringWithStr:detailModel.title];
    _contactChi2ValueLab.text = [NSString showSpaceStringWithStr:detailModel.titleChinese];

    _companyEngValueLab.text = [NSString showSpaceStringWithStr:detailModel.accountName];
    _companyChiValueLab.text = [NSString showSpaceStringWithStr:detailModel.companyNameChineseC];

    _tagValueLab.text = [NSString showSpaceStringWithStr:detailModel.cddCategory];
    _noteValueLab.text = [NSString stringWithFormat:@"%@\n%@",
                               [NSString showSpaceStringWithStr:detailModel.cddRemarks],
                               [NSString showSpaceStringWithStr:detailModel.category]];
}
- (void)dealloc {
    NSLog(@"%@ dealloc", [self class]);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = RGBA(249, 249, 249, 1);
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self viewInit];
        [self layoutInit];
    }
    return self;
}

- (void)viewInit {
    
    [super viewInit];

    [self.contentView addSubview:self.companyEngValueLab];
    [self.contentView addSubview:self.companyChiValueLab];
    
    [self.contentView addSubview:self.contactEng1ValueLab];
    [self.contentView addSubview:self.contactChi1ValueLab];
    [self.contentView addSubview:self.contactEng2ValueLab];
    [self.contentView addSubview:self.contactChi2ValueLab];

    [self.contentView addSubview:self.locationValueLab];
    [self.contentView addSubview:self.phone1ValueLab];
    [self.contentView addSubview:self.phone2ValueLab];

    [self.contentView addSubview:self.email1ValueLab];
    [self.contentView addSubview:self.email2ValueLab];

    [self.contentView addSubview:self.tagValueLab];
    [self.contentView addSubview:self.noteValueLab];

    [self.contentView addSubview:self.companykeyLabel];
    [self.contentView addSubview:self.buMenkeyLabel];
    [self.contentView addSubview:self.contactkeyLabel];

    [self.contentView addSubview:self.locationkeyLabel];
    [self.contentView addSubview:self.phonekeyLabel];
    [self.contentView addSubview:self.emailkeyLabel];
    
    [self.contentView addSubview:self.tagkeyLabel];
    [self.contentView addSubview:self.notekeyLabel];
}

- (void)layoutInit {
    
    weakself(ws);
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(ws.contentView).offset(kMargin10);
        make.right.mas_equalTo(ws.contentView).offset(-kMargin10);
        make.top.mas_equalTo(ws.contentView).offset(0);
        make.bottom.mas_equalTo(ws.contentView);
    }];
    
    //距离backview 左侧 85 + 10 ，右侧 15
    //backview 左右距 contentview  分别为10
    CGFloat width = kMainScreenWidth - 80 - 15 - 20;
    [self.companyEngValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.backView).offset(kMargin10);
        make.left.mas_equalTo(ws.backView).offset(70+ 10);
        make.width.mas_equalTo(width);
    }];
    
    [self.companyChiValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.companyEngValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];

    [self.contactEng1ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.companyChiValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];
    [self.contactChi1ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.contactEng1ValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];
    [self.contactEng2ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.contactChi1ValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];
    [self.contactChi2ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.contactEng2ValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];
    
    [self.locationValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.contactChi2ValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];

    [self.phone1ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.locationValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab).multipliedBy(0.5);
    }];
    [self.phone2ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.phone1ValueLab);
        make.left.mas_equalTo(ws.phone1ValueLab.mas_right);
        make.width.mas_equalTo(ws.phone1ValueLab);
    }];
    

    [self.email1ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.phone1ValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];
    
    [self.email2ValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.email1ValueLab.mas_bottom).offset(0);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
    }];
    
    [self.tagValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.email2ValueLab.mas_bottom).offset(kMargin10);
        make.left.mas_equalTo(ws.email1ValueLab);
        make.width.mas_equalTo(ws.email1ValueLab);
    }];
    
    [self.noteValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.tagValueLab.mas_bottom).offset(kMargin10);
//        make.left.mas_equalTo(ws.backView).offset(kMargin10);
//        make.width.mas_equalTo(ws.tagValueLab);
        make.left.mas_equalTo(ws.companyEngValueLab);
        make.width.mas_equalTo(ws.companyEngValueLab);
        make.bottom.mas_equalTo(ws.contentView).offset(-kMargin10);
    }];
    
    [self.companykeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(60, 15));
        make.top.mas_equalTo(ws.companyEngValueLab);
        make.left.mas_equalTo(ws.backView).offset(kMargin10);
    }];
    
    [self.buMenkeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.left.mas_equalTo(ws.companykeyLabel);
        make.top.mas_equalTo(ws.contactEng1ValueLab);
    }];
    [self.contactkeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.left.mas_equalTo(ws.companykeyLabel);
        make.top.mas_equalTo(ws.contactEng2ValueLab);
    }];
    
    [self.locationkeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.left.mas_equalTo(ws.companykeyLabel);
        make.top.mas_equalTo(ws.locationValueLab);
    }];
    [self.phonekeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.left.mas_equalTo(ws.companykeyLabel);
        make.top.mas_equalTo(ws.phone1ValueLab);
    }];
    [self.emailkeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.left.mas_equalTo(ws.companykeyLabel);
        make.top.mas_equalTo(ws.email1ValueLab);
    }];
    [self.tagkeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.left.mas_equalTo(ws.companykeyLabel);
        make.top.mas_equalTo(ws.tagValueLab);
    }];
    
    [self.notekeyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.left.mas_equalTo(ws.companykeyLabel);
        make.top.mas_equalTo(ws.noteValueLab);
    }];

}

- (UILabel *)companyEngValueLab {
    if (!_companyEngValueLab) {
        self.companyEngValueLab = [UILabel new];
        _companyEngValueLab.textAlignment = NSTextAlignmentLeft;
        _companyEngValueLab.font = kGeneralFontSize;
        _companyEngValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _companyEngValueLab.text = [NSString stringWithFormat:@"companyeng%@ %@ %@", kTestStr,
                                  kTestStr, kTestStr];
        _companyEngValueLab.numberOfLines = 1;
    }
    return _companyEngValueLab;
}

- (UILabel *)companyChiValueLab {
    if (!_companyChiValueLab) {
        self.companyChiValueLab = [UILabel new];
        _companyChiValueLab.textAlignment = NSTextAlignmentLeft;
        _companyChiValueLab.font = kGeneralFontSize;
        _companyChiValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _companyChiValueLab.text = [NSString stringWithFormat:@"companychi%@ %@ %@", kTestStr,
                                    kTestStr, kTestStr];
        _companyChiValueLab.numberOfLines = 1;
//        _companyChiValueLab.backgroundColor = [UIColor redColor];
    }
    return _companyChiValueLab;
}
- (UILabel *)contactEng1ValueLab {
    if (!_contactEng1ValueLab) {
        self.contactEng1ValueLab = [UILabel new];
        _contactEng1ValueLab.textAlignment = NSTextAlignmentLeft;
        _contactEng1ValueLab.font = kGeneralFontSize;
        _contactEng1ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _contactEng1ValueLab.text = [NSString stringWithFormat:@"contacteng1%@ %@ %@", kTestStr,
                                    kTestStr, kTestStr];
        _contactEng1ValueLab.numberOfLines = 1;
    }
    return _contactEng1ValueLab;
}
- (UILabel *)contactChi1ValueLab {
    if (!_contactChi1ValueLab) {
        self.contactChi1ValueLab = [UILabel new];
        _contactChi1ValueLab.textAlignment = NSTextAlignmentLeft;
        _contactChi1ValueLab.font = kGeneralFontSize;
        _contactChi1ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _contactChi1ValueLab.text = [NSString stringWithFormat:@"contactchi1%@ %@ %@", kTestStr,
                                     kTestStr, kTestStr];
        _contactChi1ValueLab.numberOfLines = 1;
    }
    return _contactChi1ValueLab;
}

- (UILabel *)contactChi2ValueLab {
    if (!_contactChi2ValueLab) {
        self.contactChi2ValueLab = [UILabel new];
        _contactChi2ValueLab.textAlignment = NSTextAlignmentLeft;
        _contactChi2ValueLab.font = kGeneralFontSize;
        _contactChi2ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _contactChi2ValueLab.text = [NSString stringWithFormat:@"contactchi2%@ %@ %@", kTestStr,
                                     kTestStr, kTestStr];
        _contactChi2ValueLab.numberOfLines = 1;
    }
    return _contactChi2ValueLab;
}

- (UILabel *)contactEng2ValueLab {
    if (!_contactEng2ValueLab) {
        self.contactEng2ValueLab = [UILabel new];
        _contactEng2ValueLab.textAlignment = NSTextAlignmentLeft;
        _contactEng2ValueLab.font = kGeneralFontSize;
        _contactEng2ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _contactEng2ValueLab.text = [NSString stringWithFormat:@"contacteng2%@ %@ %@", kTestStr,
                                     kTestStr, kTestStr];
        _contactEng2ValueLab.numberOfLines = 1;
    }
    return _contactEng2ValueLab;
}

- (UILabel *)locationValueLab {
    if (!_locationValueLab) {
        self.locationValueLab = [UILabel new];
        _locationValueLab.textAlignment = NSTextAlignmentLeft;
        _locationValueLab.font = kGeneralFontSize;
        _locationValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _locationValueLab.text = [NSString stringWithFormat:@"%@ %@ %@", kTestStr,
                                kTestStr, kTestStr];
        _locationValueLab.numberOfLines = 1;
    }
    return _locationValueLab;
}

- (UILabel *)phone1ValueLab {
    if (!_phone1ValueLab) {
        self.phone1ValueLab = [UILabel new];
        _phone1ValueLab.textAlignment = NSTextAlignmentLeft;
        _phone1ValueLab.font = kGeneralFontSize;
        _phone1ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _phone1ValueLab.text = [NSString stringWithFormat:@"phone1%@ %@ %@", kTestStr,
                                kTestStr, kTestStr];
        _phone1ValueLab.numberOfLines = 1;
    }
    return _phone1ValueLab;
}

- (UILabel *)phone2ValueLab {
    if (!_phone2ValueLab) {
        self.phone2ValueLab = [UILabel new];
        _phone2ValueLab.textAlignment = NSTextAlignmentLeft;
        _phone2ValueLab.font = kGeneralFontSize;
        _phone2ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _phone2ValueLab.text = [NSString stringWithFormat:@"phone2%@ %@ %@", kTestStr,
                                kTestStr, kTestStr];
        _phone2ValueLab.numberOfLines = 1;
    }
    return _phone2ValueLab;
}

- (UILabel *)email1ValueLab {
    if (!_email1ValueLab) {
        self.email1ValueLab = [UILabel new];
        _email1ValueLab.textAlignment = NSTextAlignmentLeft;
        _email1ValueLab.font = kGeneralFontSize;
        _email1ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _email1ValueLab.text = [NSString stringWithFormat:@"email1%@ %@ %@", kTestStr,
                             kTestStr, kTestStr];
        _email1ValueLab.numberOfLines = 1;
    }
    return _email1ValueLab;
}

- (UILabel *)email2ValueLab {
    if (!_email2ValueLab) {
        self.email2ValueLab = [UILabel new];
        _email2ValueLab.textAlignment = NSTextAlignmentLeft;
        _email2ValueLab.font = kGeneralFontSize;
        _email2ValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _email2ValueLab.text = [NSString stringWithFormat:@"email2%@ %@ %@", kTestStr,
                                kTestStr, kTestStr];
        _email2ValueLab.numberOfLines = 1;
    }
    return _email2ValueLab;
}

- (UILabel *)tagValueLab {
    if (!_tagValueLab) {
        self.tagValueLab = [UILabel new];
        _tagValueLab.textAlignment = NSTextAlignmentLeft;
        _tagValueLab.font = kGeneralFontSize;
        _tagValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _tagValueLab.text = [NSString stringWithFormat:@"tag%@ %@ %@", kTestStr,
                              kTestStr, kTestStr];
        _tagValueLab.numberOfLines = 0;
    }
    return _tagValueLab;
}

- (UILabel *)noteValueLab {
    if (!_noteValueLab) {
        self.noteValueLab = [UILabel new];
        _noteValueLab.textAlignment = NSTextAlignmentLeft;
        _noteValueLab.font = kGeneralFontSize;
        _noteValueLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _noteValueLab.text = [NSString stringWithFormat:@"note%@ %@ %@", kTestStr,
                         kTestStr, kTestStr];
        _noteValueLab.numberOfLines = 0;
    }
    return _noteValueLab;
}

- (UILabel *)companykeyLabel {
    if (!_companykeyLabel) {
        self.companykeyLabel = [UILabel new];
//        _companykeyLabel.image = [UIImage imageNamed:@"公司123"];
        _companykeyLabel.text = NSLocalizedString(@"公司", nil);
        _companykeyLabel.font = kGeneralFontSize;
        _companykeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _companykeyLabel.textAlignment = NSTextAlignmentRight;

    }
    return _companykeyLabel;
}

- (UILabel *)buMenkeyLabel {
    if (!_buMenkeyLabel) {
        self.buMenkeyLabel = [UILabel new];
//        _buMenkeyLabel.image = [UIImage imageNamed:@"部门"];
        _buMenkeyLabel.text = NSLocalizedString(@"部门", nil);
        _buMenkeyLabel.font = kGeneralFontSize;
        _buMenkeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _buMenkeyLabel.textAlignment = NSTextAlignmentRight;

    }
    return _buMenkeyLabel;
}

- (UILabel *)contactkeyLabel {
    if (!_contactkeyLabel) {
        self.contactkeyLabel = [UILabel new];
//        _contactkeyLabel.image = [UIImage imageNamed:@"联系人123"];
        _contactkeyLabel.text = NSLocalizedString(@"职位", nil);
        _contactkeyLabel.font = kGeneralFontSize;
        _contactkeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _contactkeyLabel.textAlignment = NSTextAlignmentRight;

    }
    return _contactkeyLabel;
}

- (UILabel *)locationkeyLabel {
    if (!_locationkeyLabel) {
        self.locationkeyLabel = [UILabel new];
//        _locationkeyLabel.image = [UIImage imageNamed:@"地址123"];
        _locationkeyLabel.text = NSLocalizedString(@"分区", nil);
        _locationkeyLabel.font = kGeneralFontSize;
        _locationkeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _locationkeyLabel.textAlignment = NSTextAlignmentRight;

    }
    return _locationkeyLabel;
}

- (UILabel *)phonekeyLabel {
    if (!_phonekeyLabel) {
        self.phonekeyLabel = [UILabel new];
//        _phonekeyLabel.image = [UIImage imageNamed:@"电话123"];
        _phonekeyLabel.text = NSLocalizedString(@"联系电话", nil);
        _phonekeyLabel.font = kGeneralFontSize;
        _phonekeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _phonekeyLabel.textAlignment = NSTextAlignmentRight;

    }
    return _phonekeyLabel;
}
- (UILabel *)emailkeyLabel {
    if (!_emailkeyLabel) {
        self.emailkeyLabel = [UILabel new];
//        _emailkeyLabel.image = [UIImage imageNamed:@"邮箱123"];
        _emailkeyLabel.text = NSLocalizedString(@"电子邮箱", nil);
        _emailkeyLabel.font = kGeneralFontSize;
        _emailkeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _emailkeyLabel.textAlignment = NSTextAlignmentRight;

    }
    return _emailkeyLabel;
}
- (UILabel *)tagkeyLabel {
    if (!_tagkeyLabel) {
        self.tagkeyLabel = [UILabel new];
//        _tagkeyLabel.image = [UIImage imageNamed:@"标签123"];
        _tagkeyLabel.text = NSLocalizedString(@"部门标签", nil);
        _tagkeyLabel.font = kGeneralFontSize;
        _tagkeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _tagkeyLabel.textAlignment = NSTextAlignmentRight;

    }
    return _tagkeyLabel;
}

- (UILabel *)notekeyLabel {
    if (!_notekeyLabel) {
        self.notekeyLabel = [UILabel new];
//        _notekeyLabel.image = [UIImage imageNamed:@"备注-1"];
        _notekeyLabel.text = NSLocalizedString(@"备注", nil);
        _notekeyLabel.font = kGeneralFontSize;
        _notekeyLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _notekeyLabel.textAlignment = NSTextAlignmentRight;
    }
    return _notekeyLabel;
}

/*
 部门
职位
分区
 
联系电话
电子邮箱
 
部门标签
备注
 */

@end
